﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DNA_Analysis.Models;

namespace DNA_Analysis.Controllers
{
    public class HomeController : Controller
    {
        //
        // GET: /Home/

        public ViewResult Index()
        {
            int hour = DateTime.Now.Hour;
            ViewBag.Greeting = hour < 12 ? "Good morning" : "Good afternoon";
            return View();
        }

        [HttpGet]
        public ViewResult CreateUserForm()
        {
            return View("../User/Create");
        }

        public ViewResult MenuPage()
        {
            return View();
        }

        [HttpPost]
        public ViewResult CreateUserForm(User user)
        {
            user.Perfil_Id = 1;
            Context.Instance.AddObject("User", user);
            Context.Instance.SaveChanges();

            return View("../User/Index");
            //return View("Thanks", user);
        }
    }
}